package cn.jinjimi.app.main;

import android.widget.ListView;

import java.util.List;

import bolts.Continuation;
import bolts.Task;
import cn.jinjimi.app.controller.PageController;
import cn.jinjimi.domain.entity.ProductCategory;

/**
 * @author zhenhua
 * @date 2018/5/11
 */

public class CateTabPresenter extends BasePresenter<ICategoryView> {

    public CateTabPresenter(ICategoryView view) {
        super(view);
    }

    public void onCreate() {

    }

    public void onDestory() {

    }

    public void reqPageCategory() {
        PageController.requestCategroy()
            .onSuccess(new Continuation<List<ProductCategory>, Void>() {
                @Override
                public Void then(Task<List<ProductCategory>> task) throws Exception {
                    List<ProductCategory> result = task.getResult();
                    if (result != null) {
                        getViewController().render(result);
                    }
                    return null;
                }
            }, Task.UI_THREAD_EXECUTOR);

    }
}
